/*
 * Copyright 2010 - 2011, The PLDesktop Development Team
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 */

#ifndef PLOSLOADER_H
#define PLOSLOADER_H

#include <tools/PLSingleton.h>
using namespace PLSDK;

#include <stddef.h>
using namespace std;

/**
 * Class that load the base things of the OS.<br>
 * - switch to protected mode.<br>
 * - activate memory management.<br>
 * - ...<br>
 */
class PLOS_Loader : public PLSingleton<PLOS_Loader> {
	friend class PLSingleton<PLOS_Loader>;
public:
	/**
	 * Start the OS.
	 *
	 * @param address The address of the multiboot header.
	 */
	void start(unsigned long address);
	/**
	 * Get the end address of the kernel.
	 *
	 * @return The end address.
	 */
	inline uintptr_t endKernel();
	/**
	 * Get the end of the modules part of the loaded information.
	 *
	 * @return The pointer to the end of the modules part.
	 */
	inline uintptr_t endModules();
protected:
	/**
	 * Constructor.
	 */
	PLOS_Loader();
private:
	uintptr_t m_endKernel;
	uintptr_t m_endModules;
};

uintptr_t PLOS_Loader::endKernel() {
	return m_endKernel;
}

uintptr_t PLOS_Loader::endModules() {
	return m_endModules;
}

#endif // PLOSLOADER_H
